CSharpTest.Net
CalcBTreeOrder Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTreeOptions<TKey,TValue> Class : CalcBTreeOrder Method

avgKeySizeBytes
avgValueSizeBytes

Glossary Item Box

Calculates default node-threasholds based upon the average number of bytes in key and value

Syntax

Visual Basic (Declaration) 
Public Sub CalcBTreeOrder( _
   ByVal avgKeySizeBytes As Integer, _
   ByVal avgValueSizeBytes As Integer _
) 
C# 
public void CalcBTreeOrder( 
   int avgKeySizeBytes,
   int avgValueSizeBytes
)

Parameters

avgKeySizeBytes
avgValueSizeBytes

Example

BPlusTree/BPlusTree.Test/TestBulkInsert.cs

C#Copy Code
BPlusTreeOptions<int, string> options = Options;
using (TempFile temp = new TempFile())
{
    temp.Delete();
    options.CreateFile = CreatePolicy.Always;
    options.FileName = temp.TempPath;
    options.CalcBTreeOrder(4, 4);
    Stopwatch sw = Stopwatch.StartNew();
    
    Dictionary<int, string> expected = 
        TestMergeRandom(options, 2, 300);

    Trace.TraceInformation("Creating {0} nodes in {1}.", expected.Count, sw.Elapsed);
    sw = Stopwatch.StartNew();

    options = Options;
    options.CreateFile = CreatePolicy.Never;
    options.FileName = temp.TempPath;
    options.CalcBTreeOrder(4, 4);
    using (BPlusTree<int, string> tree = new BPlusTree<int, string>(options))
    {
        VerifyDictionary(expected, tree);
    }

    Trace.TraceInformation("Verified {0} nodes in {1}.", expected.Count, sw.Elapsed);
}
VB.NETCopy Code
Dim options As BPlusTreeOptions(Of Integer, String) = Options
Using temp As New TempFile()
    temp.Delete()
    options.CreateFile = CreatePolicy.Always
    options.FileName = temp.TempPath
    options.CalcBTreeOrder(4, 4)
    Dim sw As Stopwatch = Stopwatch.StartNew()

    Dim expected As Dictionary(Of Integer, String) = TestMergeRandom(options, 2, 300)

    Trace.TraceInformation("Creating {0} nodes in {1}.", expected.Count, sw.Elapsed)
    sw = Stopwatch.StartNew()

    options = Options
    options.CreateFile = CreatePolicy.Never
    options.FileName = temp.TempPath
    options.CalcBTreeOrder(4, 4)
    Using tree As New BPlusTree(Of Integer, String)(options)
        VerifyDictionary(expected, tree)
    End Using

    Trace.TraceInformation("Verified {0} nodes in {1}.", expected.Count, sw.Elapsed)
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys